package com.dinner.service;

import com.dinner.model.AdministratorDao;
import com.dinner.model.ConsumerLoginFacade;
import com.dinner.model.SellerDao;

public class UserLoginServiceImpl implements UserLoginService {
	
	private SellerDao sellerDao = null;
	private AdministratorDao adminDao = null;
	private ConsumerLoginFacade facade = null;
	
	private com.dinner.util.UserIdentifier identifier = null;

	@Override public com.dinner.model.DinnerUser getUser(String userID, 
			String password, String type) {
		
		com.dinner.model.DinnerUser dinnerUser = null;
		
		if (type.equals(identifier.getSellerIdentifier())) {
			dinnerUser = sellerDao.getUserForLogin(userID, password);
		} else if (type.equals(identifier.getConsumerIdentifier())) {
			dinnerUser = facade.getUserForLogin(userID, password);
		} else if (type.equals(identifier.getAdminIdentifier())){
			dinnerUser = adminDao.getUserForLogin(userID, password);
		}
		return dinnerUser;
		
	}

	/**
	 * @return the sellerDao
	 */
	public SellerDao getSellerDao() {
		return sellerDao;
	}

	/**
	 * @param sellerDao the sellerDao to set
	 */
	public void setSellerDao(SellerDao sellerDao) {
		this.sellerDao = sellerDao;
	}

	/**
	 * @return the adminDao
	 */
	public AdministratorDao getAdminDao() {
		return adminDao;
	}

	/**
	 * @param adminDao the adminDao to set
	 */
	public void setAdminDao(AdministratorDao adminDao) {
		this.adminDao = adminDao;
	}

	/**
	 * @return the identifier
	 */
	public com.dinner.util.UserIdentifier getIdentifier() {
		return identifier;
	}

	/**
	 * @param identifier the identifier to set
	 */
	public void setIdentifier(com.dinner.util.UserIdentifier identifier) {
		this.identifier = identifier;
	}

	/**
	 * @return the consumerDao
	 */
	public ConsumerLoginFacade getFacade() {
		return facade;
	}

	/**
	 * @param consumerDao the consumerDao to set
	 */
	public void setFacade(ConsumerLoginFacade facade) {
		this.facade = facade;
	}

	
}
